<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html><head>
        <link rel="stylesheet" type="text/css" href="apidocs.css"/>
        <title>API docs for &ldquo;sympy.specfun.factorials.Binomial2&rdquo;</title>
        </head>
        <body><h1 class="class">Class s.s.f.Binomial2(Function):</h1><span id="part">Part of <a href="sympy.specfun.factorials.html">sympy.specfun.factorials</a></span><div class="toplevel"><div><h1 class="heading">Usage</h1>
  <p>Calculate the binomial coefficient C(n,k) = n!/(k!(n-k)!)</p>
<h1 class="heading">Notes</h1>
  <p>When n and k are positive integers, the result is always a positive 
  integer</p>
  <p>If k is a positive integer, the result is a polynomial in n that is 
  evaluated explicitly.</p>
<h1 class="heading">Examples</h1>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>binomial2(15,8)
<span class="py-output">6435</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># Building Pascal's triangle</span>
<span class="py-prompt">&gt;&gt;&gt; </span>[binomial2(0,k) <span class="py-keyword">for</span> k <span class="py-keyword">in</span> range(1)]
<span class="py-output">[1]</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>[binomial2(1,k) <span class="py-keyword">for</span> k <span class="py-keyword">in</span> range(2)]
<span class="py-output">[1, 1]</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>[binomial2(2,k) <span class="py-keyword">for</span> k <span class="py-keyword">in</span> range(3)]
<span class="py-output">[1, 2, 1]</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>[binomial2(3,k) <span class="py-keyword">for</span> k <span class="py-keyword">in</span> range(4)]
<span class="py-output">[1, 3, 3, 1]</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># n can be arbitrary if k is a positive integer</span>
<span class="py-prompt">&gt;&gt;&gt; </span>binomial2(Rational(5,4), 3)
<span class="py-output">-5/128</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>x = Symbol(<span class="py-string">'x'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>binomial2(x, 3)
<span class="py-output">(1/6)*x*(1 - x)*(2 - x)</span></pre>
</div></div><table class="children"><tr class="function"><td>Function</td><td><a href="#sympy.specfun.factorials.Binomial2.canonize">canonize</a></td><td><span class="undocumented">Undocumented</span></td></tr></table>
            <div class="function">
            <div class="functionHeader">def <a name="sympy.specfun.factorials.Binomial2.canonize">canonize(cls, n, k):</a></div>
            <div class="functionBody"><div class="undocumented">Undocumented</div></div>
            </div></body>
        